package com.syq;

import java.util.Comparator;
import java.util.function.BinaryOperator;

/**
 * @author Sun Yueqi
 * @version 1.00
 * @time 2022/6/8 19:50
 */
public class TestBinaryOperator {
    public static void main(String[] args) {
//        BinaryOperator<Integer> binaryOperator=new BinaryOperator<Integer>() {
//            @Override
//            public Integer apply(Integer integer, Integer integer2) {
//                return integer+integer2;
//            }
//        };
//        System.err.println(binaryOperator.apply(10, 11));

        BinaryOperator<Integer> binaryOperator=Integer::sum;
        System.err.println(binaryOperator.apply(5, 6));

        Comparator<Integer> comparator=Integer::compareTo;
        System.err.println(BinaryOperator.maxBy(comparator).apply(5, 6));
        System.err.println(BinaryOperator.minBy(comparator).apply(5, 6));
    }
}
